package workflowinterface;

/*
 * WorkflowInterfaceApp.java
 */

import java.awt.Point;
import org.jdesktop.application.Action;
import org.jdesktop.application.ResourceMap;
import org.jdesktop.application.SingleFrameApplication;
import org.jdesktop.application.FrameView;
import org.jdesktop.application.TaskMonitor;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import javax.swing.Timer;
import javax.swing.Icon;
import javax.swing.JDialog;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JMenuItem;

/**
 * The application's main frame.
 */
public class WorkflowInterfaceView extends FrameView {

    public WorkflowInterfaceView(SingleFrameApplication app) {
        super(app);

        initComponents();

        // status bar initialization - message timeout, idle icon and busy animation, etc
        ResourceMap resourceMap = getResourceMap();
        int messageTimeout = resourceMap.getInteger("StatusBar.messageTimeout");
        messageTimer = new Timer(messageTimeout, new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                statusMessageLabel.setText("");
            }
        });
        messageTimer.setRepeats(false);
        int busyAnimationRate = resourceMap.getInteger("StatusBar.busyAnimationRate");
        for (int i = 0; i < busyIcons.length; i++) {
            busyIcons[i] = resourceMap.getIcon("StatusBar.busyIcons[" + i + "]");
        }
        busyIconTimer = new Timer(busyAnimationRate, new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                busyIconIndex = (busyIconIndex + 1) % busyIcons.length;
                statusAnimationLabel.setIcon(busyIcons[busyIconIndex]);
            }
        });
        idleIcon = resourceMap.getIcon("StatusBar.idleIcon");
        statusAnimationLabel.setIcon(idleIcon);
        progressBar.setVisible(false);

        // connecting action tasks to status bar via TaskMonitor
        TaskMonitor taskMonitor = new TaskMonitor(getApplication().getContext());
        taskMonitor.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
            public void propertyChange(java.beans.PropertyChangeEvent evt) {
                String propertyName = evt.getPropertyName();
                if ("started".equals(propertyName)) {
                    if (!busyIconTimer.isRunning()) {
                        statusAnimationLabel.setIcon(busyIcons[0]);
                        busyIconIndex = 0;
                        busyIconTimer.start();
                    }
                    progressBar.setVisible(true);
                    progressBar.setIndeterminate(true);
                } else if ("done".equals(propertyName)) {
                    busyIconTimer.stop();
                    statusAnimationLabel.setIcon(idleIcon);
                    progressBar.setVisible(false);
                    progressBar.setValue(0);
                } else if ("message".equals(propertyName)) {
                    String text = (String)(evt.getNewValue());
                    statusMessageLabel.setText((text == null) ? "" : text);
                    messageTimer.restart();
                } else if ("progress".equals(propertyName)) {
                    int value = (Integer)(evt.getNewValue());
                    progressBar.setVisible(true);
                    progressBar.setIndeterminate(false);
                    progressBar.setValue(value);
                }
            }
        });
    }

    @Action
    public void showAboutBox() {
        if (aboutBox == null) {
            JFrame mainFrame = WorkflowInterfaceApp.getApplication().getMainFrame();
            aboutBox = new WorkflowInterfaceAboutBox(mainFrame);
            aboutBox.setLocationRelativeTo(mainFrame);
        }
        WorkflowInterfaceApp.getApplication().show(aboutBox);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        mainPanel = new javax.swing.JPanel();
        barraFerramentas = new javax.swing.JToolBar();
        abrirWorkflowBarraFerramentas = new WfButton();
        novoWorkflowBarraFerramentas = new WfButton();
        divisorAreaTrabalho = new javax.swing.JSplitPane();
        painelMenuLateral = new javax.swing.JPanel();
        menuAbasLateral = new javax.swing.JTabbedPane();
        abaWorkflows = new javax.swing.JScrollPane();
        arvoreWorkflows = new PathTree(menuArq,menuDir,menuNovo);
        divisorComponentes = new javax.swing.JSplitPane();
        painelCompBasicos = new javax.swing.JPanel();
        botaoDeclaracao = new WfButton();
        botaoAtribuicao = new WfButton();
        botaoIf = new WfButton();
        botaoSwitch = new WfButton();
        botaoWhile = new WfButton();
        botaoDoWhile = new WfButton();
        botaoFor = new WfButton();
        painelMeusComponentes = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        arvoreMeusComponentes = new PathTree(menuArq,menuDir,menuNovo);
        menuPrincipal = new javax.swing.JMenuBar();
        javax.swing.JMenu arquivoMenu = new javax.swing.JMenu();
        abrirWorkflowMenu = new javax.swing.JMenuItem();
        jMenuItem1 = new javax.swing.JMenuItem();
        javax.swing.JMenuItem exitMenuItem = new javax.swing.JMenuItem();
        javax.swing.JMenu helpMenu = new javax.swing.JMenu();
        javax.swing.JMenuItem aboutMenuItem = new javax.swing.JMenuItem();
        painelRodape = new javax.swing.JPanel();
        javax.swing.JSeparator statusPanelSeparator = new javax.swing.JSeparator();
        statusMessageLabel = new javax.swing.JLabel();
        statusAnimationLabel = new javax.swing.JLabel();
        progressBar = new javax.swing.JProgressBar();
        janelaAbrirWorkflow = new javax.swing.JFileChooser();
        menuDir = new WfPopUpMenu();
        optNovo = new javax.swing.JMenuItem();
        copyDir = new javax.swing.JMenuItem();
        pasteDir = new javax.swing.JMenuItem();
        renameDir = new javax.swing.JMenuItem();
        delDir = new javax.swing.JMenuItem();
        menuArq = new WfPopUpMenu();
        copyFile = new javax.swing.JMenuItem();
        renameFile = new javax.swing.JMenuItem();
        delFile = new javax.swing.JMenuItem();
        menuNovo = new WfPopUpMenu();
        novoDir = new javax.swing.JMenuItem();
        novoWork = new javax.swing.JMenuItem();
        novoComp = new javax.swing.JMenuItem();

        mainPanel.setName("mainPanel"); // NOI18N

        barraFerramentas.setRollover(true);
        barraFerramentas.setName("barraFerramentas"); // NOI18N

        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(workflowinterface.WorkflowInterfaceApp.class).getContext().getResourceMap(WorkflowInterfaceView.class);
        abrirWorkflowBarraFerramentas.setText(resourceMap.getString("abrirWorkflowBarraFerramentas.text")); // NOI18N
        abrirWorkflowBarraFerramentas.setFocusable(false);
        abrirWorkflowBarraFerramentas.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        abrirWorkflowBarraFerramentas.setName("abrirWorkflowBarraFerramentas"); // NOI18N
        abrirWorkflowBarraFerramentas.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        abrirWorkflowBarraFerramentas.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                arquivoMenuActionPerformed(evt);
            }
        });
        barraFerramentas.add(abrirWorkflowBarraFerramentas);

        novoWorkflowBarraFerramentas.setText(resourceMap.getString("novoWorkflowBarraFerramentas.text")); // NOI18N
        novoWorkflowBarraFerramentas.setFocusable(false);
        novoWorkflowBarraFerramentas.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        novoWorkflowBarraFerramentas.setName("novoWorkflowBarraFerramentas"); // NOI18N
        novoWorkflowBarraFerramentas.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        barraFerramentas.add(novoWorkflowBarraFerramentas);

        divisorAreaTrabalho.setName("divisorAreaTrabalho"); // NOI18N

        painelMenuLateral.setMinimumSize(new java.awt.Dimension(150, 100));
        painelMenuLateral.setName("painelMenuLateral"); // NOI18N
        painelMenuLateral.setPreferredSize(new java.awt.Dimension(180, 375));

        menuAbasLateral.setName("menuAbasLateral"); // NOI18N
        menuAbasLateral.setPreferredSize(new java.awt.Dimension(180, 375));

        abaWorkflows.setName("abaWorkflows"); // NOI18N

        arvoreWorkflows.setName("arvoreWorkflows"); // NOI18N
        abaWorkflows.setViewportView(arvoreWorkflows);

        menuAbasLateral.addTab(resourceMap.getString("abaWorkflows.TabConstraints.tabTitle"), abaWorkflows); // NOI18N

        divisorComponentes.setDividerLocation(230);
        divisorComponentes.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
        divisorComponentes.setMinimumSize(new java.awt.Dimension(180, 375));
        divisorComponentes.setName("divisorComponentes"); // NOI18N
        divisorComponentes.setPreferredSize(new java.awt.Dimension(180, 375));

        painelCompBasicos.setBackground(resourceMap.getColor("painelCompBasicos.background")); // NOI18N
        painelCompBasicos.setBorder(javax.swing.BorderFactory.createTitledBorder(new javax.swing.border.LineBorder(resourceMap.getColor("painelCompBasicos.border.border.lineColor"), 1, true), resourceMap.getString("painelCompBasicos.border.title"), javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 11), resourceMap.getColor("painelCompBasicos.border.titleColor"))); // NOI18N
        painelCompBasicos.setMinimumSize(new java.awt.Dimension(120, 100));
        painelCompBasicos.setName("painelCompBasicos"); // NOI18N
        painelCompBasicos.setLayout(new java.awt.GridLayout(10, 1));

        botaoDeclaracao.setText(resourceMap.getString("botaoDeclaracao.text")); // NOI18N
        botaoDeclaracao.setContentAreaFilled(false);
        botaoDeclaracao.setName("botaoDeclaracao"); // NOI18N
        painelCompBasicos.add(botaoDeclaracao);

        botaoAtribuicao.setText(resourceMap.getString("botaoAtribuicao.text")); // NOI18N
        botaoAtribuicao.setContentAreaFilled(false);
        botaoAtribuicao.setName("botaoAtribuicao"); // NOI18N
        painelCompBasicos.add(botaoAtribuicao);

        botaoIf.setText(resourceMap.getString("botaoIf.text")); // NOI18N
        botaoIf.setContentAreaFilled(false);
        botaoIf.setName("botaoIf"); // NOI18N
        painelCompBasicos.add(botaoIf);

        botaoSwitch.setText(resourceMap.getString("botaoSwitch.text")); // NOI18N
        botaoSwitch.setContentAreaFilled(false);
        botaoSwitch.setName("botaoSwitch"); // NOI18N
        painelCompBasicos.add(botaoSwitch);

        botaoWhile.setText(resourceMap.getString("botaoWhile.text")); // NOI18N
        botaoWhile.setContentAreaFilled(false);
        botaoWhile.setName("botaoWhile"); // NOI18N
        painelCompBasicos.add(botaoWhile);

        botaoDoWhile.setText(resourceMap.getString("botaoDoWhile.text")); // NOI18N
        botaoDoWhile.setContentAreaFilled(false);
        botaoDoWhile.setName("botaoDoWhile"); // NOI18N
        painelCompBasicos.add(botaoDoWhile);

        botaoFor.setText(resourceMap.getString("botaoFor.text")); // NOI18N
        botaoFor.setContentAreaFilled(false);
        botaoFor.setName("botaoFor"); // NOI18N
        painelCompBasicos.add(botaoFor);

        divisorComponentes.setTopComponent(painelCompBasicos);

        painelMeusComponentes.setBorder(javax.swing.BorderFactory.createTitledBorder(null, resourceMap.getString("painelMeusComponentes.border.title"), javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 11), resourceMap.getColor("painelMeusComponentes.border.titleColor"))); // NOI18N
        painelMeusComponentes.setMinimumSize(new java.awt.Dimension(173, 120));
        painelMeusComponentes.setName("painelMeusComponentes"); // NOI18N
        painelMeusComponentes.setPreferredSize(new java.awt.Dimension(173, 120));

        jScrollPane1.setName("jScrollPane1"); // NOI18N

        arvoreMeusComponentes.setBorder(new javax.swing.border.LineBorder(resourceMap.getColor("arvoreMeusComponentes.border.lineColor"), 1, true)); // NOI18N
        arvoreMeusComponentes.setName("arvoreMeusComponentes"); // NOI18N
        jScrollPane1.setViewportView(arvoreMeusComponentes);

        javax.swing.GroupLayout painelMeusComponentesLayout = new javax.swing.GroupLayout(painelMeusComponentes);
        painelMeusComponentes.setLayout(painelMeusComponentesLayout);
        painelMeusComponentesLayout.setHorizontalGroup(
            painelMeusComponentesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 161, Short.MAX_VALUE)
        );
        painelMeusComponentesLayout.setVerticalGroup(
            painelMeusComponentesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 178, Short.MAX_VALUE)
        );

        divisorComponentes.setRightComponent(painelMeusComponentes);

        menuAbasLateral.addTab(resourceMap.getString("divisorComponentes.TabConstraints.tabTitle"), divisorComponentes); // NOI18N

        javax.swing.GroupLayout painelMenuLateralLayout = new javax.swing.GroupLayout(painelMenuLateral);
        painelMenuLateral.setLayout(painelMenuLateralLayout);
        painelMenuLateralLayout.setHorizontalGroup(
            painelMenuLateralLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(menuAbasLateral, javax.swing.GroupLayout.PREFERRED_SIZE, 180, Short.MAX_VALUE)
        );
        painelMenuLateralLayout.setVerticalGroup(
            painelMenuLateralLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(menuAbasLateral, javax.swing.GroupLayout.DEFAULT_SIZE, 469, Short.MAX_VALUE)
        );

        divisorAreaTrabalho.setLeftComponent(painelMenuLateral);

        javax.swing.GroupLayout mainPanelLayout = new javax.swing.GroupLayout(mainPanel);
        mainPanel.setLayout(mainPanelLayout);
        mainPanelLayout.setHorizontalGroup(
            mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(barraFerramentas, javax.swing.GroupLayout.DEFAULT_SIZE, 884, Short.MAX_VALUE)
            .addGroup(mainPanelLayout.createSequentialGroup()
                .addGap(10, 10, 10)
                .addComponent(divisorAreaTrabalho, javax.swing.GroupLayout.DEFAULT_SIZE, 874, Short.MAX_VALUE))
        );
        mainPanelLayout.setVerticalGroup(
            mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(mainPanelLayout.createSequentialGroup()
                .addComponent(barraFerramentas, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(divisorAreaTrabalho, javax.swing.GroupLayout.DEFAULT_SIZE, 471, Short.MAX_VALUE))
        );

        menuPrincipal.setName("menuPrincipal"); // NOI18N

        arquivoMenu.setText(resourceMap.getString("arquivoMenu.text")); // NOI18N
        arquivoMenu.setName("arquivoMenu"); // NOI18N
        arquivoMenu.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                arquivoMenuActionPerformed(evt);
            }
        });

        abrirWorkflowMenu.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.CTRL_MASK));
        abrirWorkflowMenu.setText(resourceMap.getString("abrirWorkflowMenu.text")); // NOI18N
        abrirWorkflowMenu.setName("abrirWorkflowMenu"); // NOI18N
        arquivoMenu.add(abrirWorkflowMenu);

        jMenuItem1.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_N, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItem1.setText(resourceMap.getString("jMenuItem1.text")); // NOI18N
        jMenuItem1.setName("jMenuItem1"); // NOI18N
        arquivoMenu.add(jMenuItem1);

        javax.swing.ActionMap actionMap = org.jdesktop.application.Application.getInstance(workflowinterface.WorkflowInterfaceApp.class).getContext().getActionMap(WorkflowInterfaceView.class, this);
        exitMenuItem.setAction(actionMap.get("quit")); // NOI18N
        exitMenuItem.setName("exitMenuItem"); // NOI18N
        arquivoMenu.add(exitMenuItem);

        menuPrincipal.add(arquivoMenu);

        helpMenu.setText(resourceMap.getString("helpMenu.text")); // NOI18N
        helpMenu.setName("helpMenu"); // NOI18N

        aboutMenuItem.setAction(actionMap.get("showAboutBox")); // NOI18N
        aboutMenuItem.setName("aboutMenuItem"); // NOI18N
        helpMenu.add(aboutMenuItem);

        menuPrincipal.add(helpMenu);

        painelRodape.setName("painelRodape"); // NOI18N

        statusPanelSeparator.setName("statusPanelSeparator"); // NOI18N

        statusMessageLabel.setName("statusMessageLabel"); // NOI18N

        statusAnimationLabel.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        statusAnimationLabel.setName("statusAnimationLabel"); // NOI18N

        progressBar.setName("progressBar"); // NOI18N

        javax.swing.GroupLayout painelRodapeLayout = new javax.swing.GroupLayout(painelRodape);
        painelRodape.setLayout(painelRodapeLayout);
        painelRodapeLayout.setHorizontalGroup(
            painelRodapeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(statusPanelSeparator, javax.swing.GroupLayout.DEFAULT_SIZE, 884, Short.MAX_VALUE)
            .addGroup(painelRodapeLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(statusMessageLabel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 714, Short.MAX_VALUE)
                .addComponent(progressBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(statusAnimationLabel)
                .addContainerGap())
        );
        painelRodapeLayout.setVerticalGroup(
            painelRodapeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(painelRodapeLayout.createSequentialGroup()
                .addComponent(statusPanelSeparator, javax.swing.GroupLayout.PREFERRED_SIZE, 2, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(painelRodapeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(statusMessageLabel)
                    .addComponent(statusAnimationLabel)
                    .addComponent(progressBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(3, 3, 3))
        );

        janelaAbrirWorkflow.setDialogTitle(resourceMap.getString("janelaAbrirWorkflow.dialogTitle")); // NOI18N
        janelaAbrirWorkflow.setName("janelaAbrirWorkflow"); // NOI18N

        menuDir.setName("menuDir"); // NOI18N

        optNovo.setAction(actionMap.get("optNovoMouseEntered")); // NOI18N
        optNovo.setText(resourceMap.getString("optNovo.text")); // NOI18N
        optNovo.setName("optNovo"); // NOI18N
        optNovo.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                optNovoMouseEntered(evt);
            }
        });
        menuDir.add(optNovo);

        copyDir.setText(resourceMap.getString("copyDir.text")); // NOI18N
        copyDir.setName("copyDir"); // NOI18N
        menuDir.add(copyDir);
        copyDir.getAccessibleContext().setAccessibleName(resourceMap.getString("copyDir.AccessibleContext.accessibleName")); // NOI18N

        pasteDir.setText(resourceMap.getString("pasteDir.text")); // NOI18N
        pasteDir.setName("pasteDir"); // NOI18N
        menuDir.add(pasteDir);
        pasteDir.getAccessibleContext().setAccessibleName(resourceMap.getString("pasteDir.AccessibleContext.accessibleName")); // NOI18N

        renameDir.setText(resourceMap.getString("renameDir.text")); // NOI18N
        renameDir.setName("renameDir"); // NOI18N
        menuDir.add(renameDir);
        renameDir.getAccessibleContext().setAccessibleName(resourceMap.getString("optRenomear.AccessibleContext.accessibleName")); // NOI18N

        delDir.setText(resourceMap.getString("delDir.text")); // NOI18N
        delDir.setName("delDir"); // NOI18N
        menuDir.add(delDir);
        delDir.getAccessibleContext().setAccessibleName(resourceMap.getString("optExcluir.AccessibleContext.accessibleName")); // NOI18N

        menuDir.getAccessibleContext().setAccessibleName(resourceMap.getString("popUpComponentes.AccessibleContext.accessibleName")); // NOI18N

        menuArq.setName("menuArq"); // NOI18N

        copyFile.setText(resourceMap.getString("copyFile.text")); // NOI18N
        copyFile.setName("copyFile"); // NOI18N
        menuArq.add(copyFile);
        copyFile.getAccessibleContext().setAccessibleName(resourceMap.getString("copyFile.AccessibleContext.accessibleName")); // NOI18N

        renameFile.setText(resourceMap.getString("renameFile.text")); // NOI18N
        renameFile.setName("renameFile"); // NOI18N
        menuArq.add(renameFile);
        renameFile.getAccessibleContext().setAccessibleName(resourceMap.getString("renameFile.AccessibleContext.accessibleName")); // NOI18N

        delFile.setText(resourceMap.getString("delFile.text")); // NOI18N
        delFile.setName("delFile"); // NOI18N
        menuArq.add(delFile);
        delFile.getAccessibleContext().setAccessibleName(resourceMap.getString("delFile.AccessibleContext.accessibleName")); // NOI18N

        menuNovo.setName("menuNovo"); // NOI18N

        novoDir.setText(resourceMap.getString("novoDir.text")); // NOI18N
        novoDir.setName("novoDir"); // NOI18N
        menuNovo.add(novoDir);
        novoDir.getAccessibleContext().setAccessibleName(resourceMap.getString("novoDir.AccessibleContext.accessibleName")); // NOI18N

        novoWork.setText(resourceMap.getString("novoWork.text")); // NOI18N
        novoWork.setName("novoWork"); // NOI18N
        menuNovo.add(novoWork);
        novoWork.getAccessibleContext().setAccessibleName(resourceMap.getString("novoWork.AccessibleContext.accessibleName")); // NOI18N

        novoComp.setText(resourceMap.getString("novoComp.text")); // NOI18N
        novoComp.setName("novoComp"); // NOI18N
        menuNovo.add(novoComp);
        novoComp.getAccessibleContext().setAccessibleName(resourceMap.getString("novoComp.AccessibleContext.accessibleName")); // NOI18N

        setComponent(mainPanel);
        setMenuBar(menuPrincipal);
        setStatusBar(painelRodape);
    }// </editor-fold>//GEN-END:initComponents

    private void arquivoMenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_arquivoMenuActionPerformed
        int returnVal = janelaAbrirWorkflow.showOpenDialog(this.getFrame());
        if (returnVal == JFileChooser.APPROVE_OPTION) {
            File file = janelaAbrirWorkflow.getSelectedFile();
            //try {
              // O que fazer com o arquivo, por exemplo, exibí-lo em um TextArea
              //centroTrabalho.read( new FileReader( file.getAbsolutePath() ), null );
            //} catch (IOException ex) {
              //System.out.println("Problema ao acessar o arquivo "+file.getAbsolutePath());
            //}
        } else {
            System.out.println("Acesso ao arquivo cancelado pelo usuário.");
        }
    }//GEN-LAST:event_arquivoMenuActionPerformed

    private void optNovoMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_optNovoMouseEntered
        JMenuItem act = (JMenuItem) evt.getComponent();
        WfPopUpMenu parent = (WfPopUpMenu) act.getParent();

        Point parentPosition = parent.getLocationOnScreen();
        menuNovo.setLocation(parentPosition.x + parent.getWidth() - 25,evt.getYOnScreen());
        menuNovo.setVisible(true);
    }//GEN-LAST:event_optNovoMouseEntered

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JScrollPane abaWorkflows;
    private WfButton abrirWorkflowBarraFerramentas;
    private javax.swing.JMenuItem abrirWorkflowMenu;
    private PathTree arvoreMeusComponentes;
    private PathTree arvoreWorkflows;
    private javax.swing.JToolBar barraFerramentas;
    private WfButton botaoAtribuicao;
    private WfButton botaoDeclaracao;
    private WfButton botaoDoWhile;
    private WfButton botaoFor;
    private WfButton botaoIf;
    private WfButton botaoSwitch;
    private WfButton botaoWhile;
    private javax.swing.JMenuItem copyDir;
    private javax.swing.JMenuItem copyFile;
    private javax.swing.JMenuItem delDir;
    private javax.swing.JMenuItem delFile;
    private javax.swing.JSplitPane divisorAreaTrabalho;
    private javax.swing.JSplitPane divisorComponentes;
    private javax.swing.JMenuItem jMenuItem1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JFileChooser janelaAbrirWorkflow;
    private javax.swing.JPanel mainPanel;
    private javax.swing.JTabbedPane menuAbasLateral;
    private WfPopUpMenu menuArq;
    private WfPopUpMenu menuDir;
    private WfPopUpMenu menuNovo;
    private javax.swing.JMenuBar menuPrincipal;
    private javax.swing.JMenuItem novoComp;
    private javax.swing.JMenuItem novoDir;
    private javax.swing.JMenuItem novoWork;
    private WfButton novoWorkflowBarraFerramentas;
    private javax.swing.JMenuItem optNovo;
    private javax.swing.JPanel painelCompBasicos;
    private javax.swing.JPanel painelMenuLateral;
    private javax.swing.JPanel painelMeusComponentes;
    private javax.swing.JPanel painelRodape;
    private javax.swing.JMenuItem pasteDir;
    private javax.swing.JProgressBar progressBar;
    private javax.swing.JMenuItem renameDir;
    private javax.swing.JMenuItem renameFile;
    private javax.swing.JLabel statusAnimationLabel;
    private javax.swing.JLabel statusMessageLabel;
    // End of variables declaration//GEN-END:variables

    private final Timer messageTimer;
    private final Timer busyIconTimer;
    private final Icon idleIcon;
    private final Icon[] busyIcons = new Icon[15];
    private int busyIconIndex = 0;

    private JDialog aboutBox;
}
